package com.uzai.console.web.fd;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.fd.fdautoconfig.FdAutoConfigDto;
import com.uzai.console.dto.fd.fdautoconfig.FdAutoConfigIdDto;
import com.uzai.console.dto.fd.fdautoconfig.FdAutoConfigQuery;
import com.uzai.console.dto.fd.fdautoconfig.FdAutoConfigStatusDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.fd.FdAutoConfigService;
import com.uzai.console.service.sysmaterial.SysMaterialService;
import com.uzai.console.vo.fd.fdautoconfig.FdAutoConfigVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 朋友圈自动发单配置
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "自动发单配置",tags = "个人微信|发单|自动发单配置")
@ApiSort(31)
@RestController
public class FdAutoConfigController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(FdAutoConfigController.class);

    @Autowired
    private FdAutoConfigService fdAutoConfigService;
    @Autowired
    private SysMaterialService sysMaterialService;

    @ApiOperation(value = "分页查询自动发单配置列表", notes = "分页查询自动发单配置列表", response = FdAutoConfigVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/fdAutoConfig/findByPage")
    public Object findFdAutoConfigByPage(@RequestBody FdAutoConfigQuery fdAutoConfigQuery){
        return fdAutoConfigService.findFdAutoConfigByPage(fdAutoConfigQuery);
    }

    @SystemLogType(model = SystemModelEnum.FdAutoConfig, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加自动发单配置", notes = "添加自动发单配置")
    @ApiOperationSupport(order = 2)
    @PostMapping("/fdAutoConfig/add")
    public Object addFdAutoConfig(@RequestBody FdAutoConfigDto fdAutoConfigDto){
        fdAutoConfigService.addFdAutoConfig(fdAutoConfigDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdAutoConfig, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "编辑自动发单配置", notes = "编辑自动发单配置" )
    @ApiOperationSupport(order = 3)
    @PostMapping("/fdAutoConfig/update")
    public Object updateFdAutoConfig(@RequestBody FdAutoConfigDto fdAutoConfigDto){
        fdAutoConfigService.updateFdAutoConfig(fdAutoConfigDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.FdAutoConfig, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除自动发单配置", notes = "删除自动发单配置")
    @ApiOperationSupport(order = 4)
    @PostMapping("/fdAutoConfig/delete")
    public Object deleteFdAutoConfig(@RequestBody FdAutoConfigIdDto fdAutoConfigIdDto){
        fdAutoConfigService.deleteFdAutoConfig(fdAutoConfigIdDto);
        return true;
    }

    @ApiOperation(value = "查询自动发单配置详情", notes = "查询自动发单配置详情", response = FdAutoConfigVo.class)
    @ApiOperationSupport(order = 5)
    @PostMapping("/fdAutoConfig/findById")
    public Object findFdAutoConfig(@RequestBody FdAutoConfigIdDto fdAutoConfigIdDto){
        return fdAutoConfigService.findFdAutoConfig(fdAutoConfigIdDto);
    }

    @SystemLogType(model = SystemModelEnum.FdAutoConfig, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "开启关闭自动发单配置", notes = "开启关闭自动发单配置", response = Boolean.class)
    @ApiOperationSupport(order = 8)
    @PostMapping("/fdAutoConfig/updateStatus")
    public Object updateStatus(@RequestBody FdAutoConfigStatusDto fdAutoConfigStatusDto){
        fdAutoConfigService.updateStatus(fdAutoConfigStatusDto);
        return true;
    }

}
